package com.stedu;

import com.stedu.exception.SteduException;
import com.stedu.mapper.CourseMapper;
import com.stedu.mapper.StudentMapper;
import com.stedu.mapper.TeacherAndStudentMapper;
import com.stedu.mapper.TeacherMapper;
import com.stedu.service.CourseService;
import com.stedu.service.TeacherService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class SelectClassApplicationTests2 {
    @Autowired
    private TeacherMapper teacherMapper;
    @Autowired
    private TeacherService teacherService;
    @Autowired
    private CourseMapper courseMapper;
    @Autowired
    private CourseService courseService;
    @Autowired
    private TeacherAndStudentMapper teacherAndStudentMapper;
    @Autowired
    private StudentMapper studentMapper;
    @Test
    public void Test1() throws SteduException {
        //Teacher t = new Teacher(6, "05386", "牛马666", 28, "男", 99, "1", 2, null);
        //System.out.println(teacherMapper.update(t));
        //teacherMapper.selectAll().stream().forEach(System.out::println);
        teacherMapper.selectByTname("").stream().forEach(System.out::println);
    }
    @Test
    public void Test2() throws SteduException {
        teacherService.selectByTname("").stream().forEach(System.out::println);
    }
    @Test
    public void Test3() throws SteduException {
        //System.out.println(courseMapper.selectByCid(1));
        courseMapper.selectAll().stream().forEach(System.out::println);
    }
    @Test
    public void Test4() throws SteduException {
        System.out.println(courseService.selectByCid(1));
    }
    @Test
    public void Test5() throws SteduException {
        //teacherMapper.selectAll().stream().forEach(System.out::println);
        teacherService.selectAll().stream().forEach(System.out::println);
    }
    @Test
    public void Test6() throws SteduException {
        if(studentMapper.selectByZid(1).isEmpty()){
            System.out.println("1");
        }else{
            System.out.println("2");
        }
    }
}
